<h2>Categor&iacute;as - Editar</h2>

<?php

if(isset($_GET['id']))
{
	$q = 'SELECT * FROM ' . $tcateg . ' WHERE id=' . $_GET['id'];
	$res = mysqli_query($conn,$q);
}

if(empty($res))
{
	echo '<p class="text-error">Categor&iacute;a no encontrada</p>';
}
else
{
	$row = mysqli_fetch_assoc($res);

?>

<form action="index.php">
<fieldset>
<input type="hidden" name="module" value="categories" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="id" value="<?php echo $row['id'];?>" />
<legend>Editar categor&iacute;a</legend>
<label for="name_input">Nombre</label>
<input id="name_input" type="text" name="name" value="<?php echo $row['name'];?>" placeholder="Nombre" />
<span class="help-block">
<button class="btn btn-primary" type="submit">Actualizar</button>
<a class="btn" href="index.php?module=categories">Cancelar</a>
</span>
</fieldset>
</form>

<?php
}
